Skip to content

agent: @U0AJM7X8FBR Admin + Docs + API - we want to update the /coding page in #22

Merged
sweetmantech merged 4 commits intomainfrom
feature/coding-pr-merged-status
Mar 24, 2026
Merged

agent: @U0AJM7X8FBR Admin + Docs + API - we want to update the /coding page in #22
sweetmantech merged 4 commits intomainfrom
feature/coding-pr-merged-status

Conversation

@sweetmantech
Copy link
Copy Markdown
Contributor

@sweetmantech sweetmantech commented Mar 23, 2026

Automated PR from coding agent.

Prompt: @U0AJM7X8FBR Admin + Docs + API - we want to update the /coding page in the admin codebase to view analytics around pull requests MERGED by the coding-agent.

Summary by CodeRabbit

  • New Features
    • Charts now support displaying a third data series.
    • Added merged pull request tracking with a "PRs Merged" metric to project dashboards.
    • Merged pull requests are now visually marked with a 🚢 emoji in pull request tables.

Updates the coding agent Slack tags page to surface which pull requests
have been merged, using the new GET /api/admins/coding/pr endpoint.

- types/coding-agent.ts — CodingPrStatus, CodingPrStatusResponse types
- lib/recoup/fetchCodingPrStatus.ts — HTTP client for the new endpoint
- hooks/useCodingPrStatus.ts — React Query hook, returns Set of merged URLs
- lib/coding-agent/getTagsByDate.ts — adds merged_pr_count per date
- components/Admin/AdminLineChart.tsx — adds thirdLine prop support
- components/CodingAgentSlackTags/SlackTagsColumns.tsx — ship 🚢 emoji for merged PRs
- components/CodingAgentSlackTags/SlackTagsTable.tsx — accepts mergedPrUrls prop
- components/CodingAgentSlackTags/CodingAgentSlackTagsPage.tsx — wires it all together:
  merged PRs top stat, "PRs Merged" chart line, ship emoji in table

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
admin Ready Ready Preview Mar 24, 2026 3:17am

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 23, 2026

Warning

Rate limit exceeded

@sweetmantech has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 3 minutes and 27 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d5852bc8-62f0-43d2-8cd0-2f2abf82e499

📥 Commits

Reviewing files that changed from the base of the PR and between a51eacf and ba22960.

📒 Files selected for processing (3)
  • components/CodingAgentSlackTags/CodingAgentSlackTagsPage.tsx
  • components/CodingAgentSlackTags/SlackTagsTable.tsx
  • components/CodingAgentSlackTags/createSlackTagsColumns.tsx
📝 Walkthrough

Walkthrough

The changes introduce merged PR tracking across the admin dashboard. A new useCodingPrStatus hook fetches PR status data from the backend, while fetchCodingPrStatus handles the API request. The AdminLineChart now displays a third data series for merged PRs, table columns are refactored to support dynamic PR marking with a ship emoji (🚢), and aggregation logic tracks merged PR counts by date.

Changes

Cohort / File(s) Summary
Chart Extension
components/Admin/AdminLineChart.tsx, components/CodingAgentSlackTags/CodingAgentSlackTagsPage.tsx
Renamed SecondLine interface to ExtraLine, added optional thirdLine prop with count3 chart config, updated legend rendering condition, and wired merged PR dataset into the chart via CodingAgentSlackTagsPage.
Table & Column Refactoring
components/CodingAgentSlackTags/SlackTagsColumns.tsx, components/CodingAgentSlackTags/SlackTagsTable.tsx
Converted static slackTagsColumns to factory function createSlackTagsColumns(mergedPrUrls) that marks merged PRs with 🚢 prefix; updated SlackTagsTable to accept and pass mergedPrUrls to column factory.
PR Status Integration
hooks/useCodingPrStatus.ts, lib/recoup/fetchCodingPrStatus.ts
Added new hook to aggregate PR URLs and fetch merged PR statuses via Privy authentication; added API function to query /api/admins/coding/pr endpoint with PR URLs and return status results.
Data Aggregation & Types
lib/coding-agent/getTagsByDate.ts, types/coding-agent.ts
Extended getTagsByDate to accept optional mergedPrUrls set and track merged_pr_count per date bucket; added CodingPrStatus and CodingPrStatusResponse type definitions for API responses.

Sequence Diagram

sequenceDiagram
    participant Page as CodingAgentSlackTagsPage
    participant Hook as useCodingPrStatus
    participant Privy as Privy
    participant API as fetchCodingPrStatus
    participant Server as Backend API
    participant Chart as AdminLineChart
    participant Table as SlackTagsTable

    Page->>Hook: useCodingPrStatus(data?.tags)
    Hook->>Privy: usePrivy() - get accessToken
    Privy-->>Hook: accessToken
    
    Note over Hook: Extract unique PR URLs<br/>from tags
    Hook->>API: fetchCodingPrStatus(token, PRs)
    API->>Server: GET /api/admins/coding/pr<br/>?pull_requests=...
    Server-->>API: {pull_requests: [{url, status}]}
    API-->>Hook: Set of merged PR URLs
    
    Hook-->>Page: mergedPrUrls Set
    
    Page->>Page: getTagsByDate(tags, mergedPrUrls)<br/>+ merged_pr_count per date
    Page->>Chart: data, secondLine, thirdLine
    Page->>Table: tags, mergedPrUrls
    
    Chart-->>Page: Renders with 3 lines
    Table->>Table: createSlackTagsColumns(mergedPrUrls)
    Table-->>Page: Renders PR links with 🚢 prefix
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 A rabbit hops through metrics bright,
Merged ships sail in the dashboard light!
Third lines shimmer, PRs align,
With 🚢 emojis marking time.
Aggregated dreams come true,
Status tracked in sets of blue! 🌊

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title is incomplete and vague, using an incomplete phrase 'we want to update the /coding page in' without finishing the thought or clarifying the actual change being made. Complete the title with a clear, concise summary of the main change, such as 'Add merged PR status visibility to coding agent Slack tags page' or 'Display merged PR metrics on /coding analytics page'.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/coding-pr-merged-status

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

…boolean

Aligns with API change from { merged: boolean } to { status: "open" | "closed" | "merged" }.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
}

/** @deprecated Use createSlackTagsColumns() instead */
export const slackTagsColumns = createSlackTagsColumns();
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the deprecated variable and refactor this file to be the same name as the function.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved — removed deprecated export, renamed file to createSlackTagsColumns.tsx.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
hooks/useCodingPrStatus.ts (1)

15-26: Unstable query key may cause unnecessary refetches.

allPrUrls is recomputed on every render, creating a new array reference. React Query compares query keys by value for primitives but by reference for objects/arrays within the key. While the array contents may be the same, the changing reference could affect cache behavior.

Consider memoizing or sorting the URLs for a stable key:

♻️ Proposed fix for stable query key
+import { useMemo } from "react";
+
 export function useCodingPrStatus(tags: SlackTag[] | undefined) {
   const { ready, authenticated, getAccessToken } = usePrivy();

-  const allPrUrls = [...new Set(tags?.flatMap((tag) => tag.pull_requests ?? []) ?? [])];
+  const allPrUrls = useMemo(
+    () => [...new Set(tags?.flatMap((tag) => tag.pull_requests ?? []) ?? [])].sort(),
+    [tags]
+  );

   return useQuery({
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@hooks/useCodingPrStatus.ts` around lines 15 - 26, The query key is unstable
because allPrUrls is recreated each render; memoize and normalize it before
passing to useQuery: compute allPrUrls using React's useMemo (based on tags) and
produce a stable representation (e.g., sort the URLs and/or join into a string)
so the reference/value is stable, then use that memoized value in queryKey and
in the fetch (keep getAccessToken and fetchCodingPrStatus usage the same).
lib/recoup/fetchCodingPrStatus.ts (1)

20-25: Consider batching for URLs with 50+ PRs to avoid exceeding safe URL length limits.

The query parameter approach works well for typical usage (< 20 PRs stay well under 2000 characters), but URLs with 50+ PRs risk exceeding safe cross-browser limits (~2000 chars). Since the API only supports GET (no POST variant found), implement batching to split large requests if this function will regularly handle many PRs.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/recoup/fetchCodingPrStatus.ts` around lines 20 - 25, fetchCodingPrStatus
currently appends all pullRequests to a single GET URL which can exceed safe URL
length for large arrays; change it to batch pullRequests into smaller chunks
(e.g., 20–25 IDs per batch), for each chunk build a URL (using the existing URL
and searchParams.append("pull_requests", pr) logic), issue parallel fetches
(Promise.all) with the same headers/Authorization, and then merge/concatenate
the responses before returning; ensure you keep the same error handling and
response parsing used around the existing fetch call and reference the
pullRequests variable, url construction code, and the fetch invocation when
implementing the batching.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@hooks/useCodingPrStatus.ts`:
- Around line 15-26: The query key is unstable because allPrUrls is recreated
each render; memoize and normalize it before passing to useQuery: compute
allPrUrls using React's useMemo (based on tags) and produce a stable
representation (e.g., sort the URLs and/or join into a string) so the
reference/value is stable, then use that memoized value in queryKey and in the
fetch (keep getAccessToken and fetchCodingPrStatus usage the same).

In `@lib/recoup/fetchCodingPrStatus.ts`:
- Around line 20-25: fetchCodingPrStatus currently appends all pullRequests to a
single GET URL which can exceed safe URL length for large arrays; change it to
batch pullRequests into smaller chunks (e.g., 20–25 IDs per batch), for each
chunk build a URL (using the existing URL and
searchParams.append("pull_requests", pr) logic), issue parallel fetches
(Promise.all) with the same headers/Authorization, and then merge/concatenate
the responses before returning; ensure you keep the same error handling and
response parsing used around the existing fetch call and reference the
pullRequests variable, url construction code, and the fetch invocation when
implementing the batching.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e7cca115-b125-4350-977a-7db20d63cc83

📥 Commits

Reviewing files that changed from the base of the PR and between 0e1af72 and a51eacf.

📒 Files selected for processing (8)
  • components/Admin/AdminLineChart.tsx
  • components/CodingAgentSlackTags/CodingAgentSlackTagsPage.tsx
  • components/CodingAgentSlackTags/SlackTagsColumns.tsx
  • components/CodingAgentSlackTags/SlackTagsTable.tsx
  • hooks/useCodingPrStatus.ts
  • lib/coding-agent/getTagsByDate.ts
  • lib/recoup/fetchCodingPrStatus.ts
  • types/coding-agent.ts

sweetmantech and others added 2 commits March 23, 2026 22:16
…eprecated export

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Shows percentage of Slack tags that resulted in a merged PR.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sweetmantech sweetmantech merged commit 7939492 into main Mar 24, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant